Skip to content

Fix CI coverage-comment failure on push to main - #100

Merged
kjw142857 merged 3 commits into
mainfrom
fix/ci-coverage-comment-push
Sep 2, 2026
Merged

Fix CI coverage-comment failure on push to main#100
kjw142857 merged 3 commits into
mainfrom
fix/ci-coverage-comment-push

Conversation

@martin-henz

Copy link
Copy Markdown
Member

Summary

  • ArtiomTr/jest-coverage-report-action@v2's default output: comment step tries to post a PR comment even when the workflow was triggered by a direct push to main (e.g. after merging a PR), where there's no associated PR — this fails with HttpError: Resource not accessible by integration and marks the whole build job as failed even though build/tests pass. See failing run: https://github.com/source-academy/java-slang/actions/runs/33060105554/job/98476472987
  • Gate the coverage-comment action to pull_request events only; run plain yarn test on push.
  • Also fixes a pre-existing lint/type issue that was blocking local commits: ExceptionTableEntry.catchType was typed any | null (redundant union, eslint error), which also masked that the field actually holds a ConstantClass (not a ClassData) until resolved via .resolve(). Narrowed to ConstantClass | null to match how it's populated in Attributes.ts and consumed in thread.ts.

Test plan

  • yarn tsc --noEmit passes
  • yarn test passes (65 suites / 1148 tests)
  • Confirm the build workflow succeeds on both a pull_request run (coverage comment posts) and a push-to-main run (no failure) after merge

🤖 Generated with Claude Code

https://claude.ai/code/session_01TujL5U9Kg6vHKvRR7zryE4

martin-henz and others added 2 commits August 27, 2026 18:30
exception-table.ts declared ExceptionTableEntry.catchType as
`any | null`, which eslint flags as a redundant union and which
also masked a latent type mismatch (the field actually holds a
ConstantClass, not a ClassData, until resolved). Narrow it to
ConstantClass | null to match how it's populated in Attributes.ts
and consumed in thread.ts.

The pre-commit hook's repo-wide `eslint --fix` and `prettier --write`
also picked up and applied a handful of pre-existing import-order
and formatting fixes in other files that were tripping the hook.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TujL5U9Kg6vHKvRR7zryE4
jest-coverage-report-action tries to post a PR comment even on
direct pushes to main, where no PR exists, causing the build job
to fail with "Resource not accessible by integration". Only run
the coverage-comment action on pull_request events, and run plain
yarn test on push.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TujL5U9Kg6vHKvRR7zryE4
@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 72.63% 7589/10449
🔴 Branches
59.35% (+0.02% 🔼)
2555/4305
🟡 Functions 69.54% 1354/1947
🟡 Lines
73.5% (+0% 🔼)
7146/9722

Test suite run success

1148 tests passing in 65 suites.

Report generated by 🧪jest coverage report action from 1381f6c

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The workflow change directly addresses the documented CI failure mode and the remaining edits are low-risk type/format adjustments, with only a small lint/style nit noted in review comments.

Pull request overview

This PR prevents the CI build job from failing on push to main by ensuring the Jest coverage action only attempts to post PR comments on pull_request events, while still running tests on push. It also tightens JVM exception-table typing and applies a set of small formatting/lint cleanups in compiler/JVM code.

Changes:

  • Gate ArtiomTr/jest-coverage-report-action@v2 to pull_request events and run yarn test directly on non-PR events.
  • Narrow JVM ExceptionTableEntry.catchType to ConstantClass | null (instead of any | null) and adjust related signatures/imports.
  • Misc formatting/import tidy-ups across compiler and code generator modules.
File summaries
File Description
src/types/typeFactories/methodFactory.ts Minor cleanup in throws-clause handling (member-access style).
src/jvm/types/class/Method.ts Import ordering adjustment related to exception-table usage.
src/jvm/exception-table.ts Narrow catchType typing to ConstantClass | null and update insert signature.
src/compiler/symbol-table.ts Import ordering + formatting in final-method override check.
src/compiler/error.ts Formatting cleanup.
src/compiler/compiler.ts Formatting cleanup for class symbol insertion / output array.
src/compiler/code-generator.ts Import ordering and formatting cleanup in code generation paths.
src/compiler/binary-writer.ts Formatting cleanup for normalizeClassFile signature.
.github/workflows/build.yml Gate coverage comment step to PRs; add explicit test step for push-to-main runs.
Review details
  • Files reviewed: 8/9 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/types/typeFactories/methodFactory.ts Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@kjw142857
kjw142857 self-requested a review September 2, 2026 02:55

@kjw142857 kjw142857 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@kjw142857
kjw142857 merged commit 478ce86 into main Sep 2, 2026
4 checks passed
@kjw142857
kjw142857 deleted the fix/ci-coverage-comment-push branch September 2, 2026 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants